<template>
  <div>
    <Navbar :appTitle="appTitle" />
    <div
      class="form-content wrap-apply"
      :style="{
        top: GLOBAL.currentEnvironment ? '0' : '',
        height: GLOBAL.currentEnvironment ? '100%' : '100%',
      }"
    >
      <div class="d-head">
        <div class="content">
          <div class="left">
            <div class="title">{{ buildForm.shelvesTaskCode || '-' }}</div>
            <div class="row">
              <span style="color:#191f25">业务类型：{{buildForm.inboundTaskTypeText || "-"}}</span>
            </div>
          </div>
          <div class="right">
            <div class="row warining">
              待上架：
              <span>{{buildForm.unShelvedNum}}</span>
            </div>
            <div class="row success">
              已上架：
              <span>{{buildForm.shelvedNum}}</span>
            </div>
          </div>
        </div>
      </div>

      <div class="list" v-if="entryDetails && entryDetails.length != 0">
        <div class="operation">
          <div>
            <span class="imgSpan">
              物品明细
            </span>
          </div>
        </div>
        <div
          v-for="(p, i) in entryDetails"
          :key="i"
          class="wrap"
        >
          <div style="padding-top: 10px;"> 
            <van-cell-group>
              <div class="top">
                <div class="icon"></div>
                <div class="title titleWidth">
                  {{ p.goodsCode || '-'}}| {{ p.goodsName || '-'}}| {{ p.goodsSpec || '-'}}
                </div>
              </div>
              <div class="center">
                <div>
                  <p>
                    <span class="key">产地：</span>
                    <span class="value">{{ p.address || '-'}}</span>
                  </p>
                  <p>
                    <span class="key">包装规格：</span>
                    <span class="value">{{ p.packageSpec	|| '-'}}</span>
                  </p>
                  <p>
                    <span class="key">单位：</span>
                    <span class="value">{{ p.unitName	|| '-'}}</span>
                  </p>

                  <p>
                    <span class="key">批号：</span>
                    <span class="value">{{ p.batchCode	|| '-'}}</span>
                  </p>
                  <p>
                    <span class="key">生产日期：</span>
                    <span class="value">{{ p.produceDate	|| '-'}}</span>
                  </p>
                  <p>
                    <span class="key">收货数量：</span>
                    <span class="value">{{ p.receiptedNumText	|| '-'}}</span>
                  </p>
                </div>
              </div>
            </van-cell-group>
          </div>
        </div>
      </div>
      <van-empty v-else description="已上架数据为空" />
    </div>
  </div>
</template>
<script>
import Navbar from "@/components/navBar/navBar_right";
import {
  shelvesTaskDetail,
} from "@/api/inventoryOrder";
import store from "@/store";

export default {
  name: "shelfTaskGoodsDetail",
  components: {
    Navbar,
  },
  data() {
    return {
      appTitle: "已上架",
      buildForm: {},
      entryDetails: [],
    };
  },
  beforeRouteLeave(to, from, next) {
    if (this.isShowLatticeNotification) {
      this.isShowLatticeNotification = false;
      this.appTitle = '上架';
      next(false);
    } else {
      next();
    }
  },
  async created() {
    store.commit("SET_CURRENT_PREFIX", "/jksaas-produce/produce");
    this.initData();
  },
  methods: {
    // 初始化页面数据
    initData() {
      let id = this.$route.query.id;
      
      if(id) {
        // 上架详情
        shelvesTaskDetail({taskId: id}).then((res) => {
          if (res.code == 200 && res.result) {
            this.buildForm = res.result;

            if( res.result.shelvedGoodsList.length != 0) {
              this.entryDetails = res.result.shelvedGoodsList.map((ele) => {
                return {
                  ...ele,
                }
              })
            }else {
              this.entryDetails = []
            }
          } else {
            this.$toast(res.message);
          }
        });
      }
    },
  },
};
</script>
<style lang="scss" scoped>
@import "@/assets/theme.scss";
@import "@/views/workManagement/materialRequisition/materialForm.scss";
.form-content {
  width: 100%;
  height: calc(100vh - 203px);
  background: #f5f5f5;
  overflow: scroll;
  padding: 20px 0;
  .formgroup {
    background: #ffffff;
    margin-top: 0.1rem;
    margin-bottom: 0.2rem;
    padding-top: 0.1rem;

    .title {
      width: 0.58rem;
      height: 0.14rem;
      font-size: 0.15rem;
      font-family: PingFang SC;
      font-weight: 400;
      color: #191f25;
      line-height: 0.05rem;
      margin-left: 0.16rem;
    }
  }
  .search-bottoms {
    width: 100%;
    height: 100px;
    background: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    bottom: 0px;
    padding: 0rem 11px;
    box-sizing: border-box;
    font-size: 32px;
    font-weight: 500;
    z-index: 9;
    .btnconfirm {
      flex: 1;
      background: #1890ff;
      box-sizing: border-box;
      height: 78px;
      display: flex;
      justify-content: center;
      align-items: center;
      border-radius: 6px;
      color: #ffffff;
    }
  }
}
.bottomLine {
  height: 1px;
  background-color: #f2f2f2;
  margin: 0 2px;
}
.haveUnitBox {
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-sizing: border-box;
  padding-right: 32px;
  /deep/ .van-cell {
    padding-right: 0;
    width: 490px;
  }
  /deep/ .van-field__control {
    max-width: 700px;
  }
}
/deep/ .van-nav-bar {
  z-index: 99;
}
/deep/.van-sidebar-item--select::before {
  color: #1890ff;
  background-color: #1890ff;
}
/deep/.van-tree-select__item--active {
  color: #1890ff;
}
.required span::after {
  left: -20px;
  top: 3px;
}
.filedClear {
  width: 28px;
  height: 28px;
}
.formItemFlex {
  display: flex;
  flex-direction: row;
  position: relative;
  left: -35px;
  .FormTit {
    min-width: 2.5rem;
    padding-top: 0.33rem;
  }
  .haveUnitBox {
    flex: 1;
  }
}
.list {
  margin-top: 10px;
  .operation {
    width: 100%;
    height: 80px;
    line-height: 80px;
    background: #ffff;
    display: flex;
    justify-content: space-between;
    padding: 0 22px;
    font-size: 28px;
    font-weight: 500;
    color: #191f25;
    border-bottom: 1px solid #f2f2f2;
    .img1 {
      width: 40px;
      height: 40px;
      margin-top: -10px;
    }
    .img2 {
      width: 40px;
      height: 40px;
      margin-top: -10px;
    }
    .imgSpan {
      margin-left: 2px;
      font-size: 30px;
      font-family: PingFang SC;
      font-weight: 800;
      color: #191f25;
    }
  }
  .wrap {
    background: #fff;
    width: 100vw;
    margin-bottom: 20px;
    padding: 32px;
    .otherText {
      display: flex; 
      justify-content: space-between;
      font-size: 32px;
      font-weight: bold;
      color: #191f25;
      .deleteStyle {
        font-weight: 400; 
        color: #ff4d4f
      }
    }
    .top {
      display: flex;
      justify-content: flex-start;
      padding-top: 10px;
      .icon {
        width: 6px;
        height: 32px;
        background: #1890ff;
        margin: 6px 10px 0 10px;
      }
      .title {
        width: 602px;
        margin-right: 20px;
        font-size: 30px;
        font-family: PingFang SC;
        font-weight: 400;
        color: #191f25;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .titleWidth {
        width: 572px;
      }
    }
    .center {
      padding-left: 28px;
      p {
        margin: 16px 0;
        font-size: 28px;
        display: flex;
        position: relative;
        .key {
          color: #888888;
        }
        .value {
          color: #191f25;
          width: 380px;
          display: block;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
        }
        .arrow {
          color: #1890ff;
          position: absolute;
          right: -10px;
        }
      }
      .showAll {
        background: #f5f8ff;
        width: 100vw;
        margin-left: -30px;
        padding: 30px;
        margin-bottom: 30px;
      }
      .showAll2 {
        width: 100%;
        margin: 0 0 30px 0;
        padding: 30px 0;
      }
    }
  }
}
.d-head {
  width: 100%;
  padding: 32px;
  background: #ffffff;
  .content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    .left {
      flex: 1;
      .title {
        font-size: 32px;
        font-family: PingFang SC;
        font-weight: 500;
        color: #191f25;
        line-height: 32px;

        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        -o-text-overflow: ellipsis;
      }
      .row {
        font-size: 28px;
        font-family: PingFang SC;
        font-weight: 400;
        color: #888888;
        margin-top: 20px;
      }
    }
    .right {
      flex: 1;
      text-align: right;
      font-size: 26px;
      .row {
        padding-top: 13px;
      }
      .warining {
        color: #fe9400;
      }
      .success {
        color: #4bd863;
      }
    }
  }
}
.otherTaps {
  background: #ffffff;
  padding: 32px;
  margin-top: 20px;
  .title {
    padding-bottom: 20px;
    border-bottom: 1px solid #eeeeee;
    .icon {
      display: inline-block;
      width: 6px;
      height: 28px;
      background: #1890ff;
    }
    .content {
      width: 126px;
      height: 32px;
      font-size: 32px;
      font-family: PingFang SC;
      font-weight: bold;
      color: #191f25;
      line-height: 44px;
      margin-left: 20px;
    }
  }
  .content {
    .row {
      font-size: 28px;
      font-family: PingFang SC;
      font-weight: 400;
      margin-top: 32px;
      display: flex;
      .r-label {
        color: #888888;
        display: block;
        // width: 0.7rem;
        //   border: 1px solid red;
      }
      .r-column {
        display: block;
        color: #191f25;
        width: 500px; 
        //   border: 1px solid red;
        //    width: 1rem;
      }
    }
    .fhrow {
      display: flex;
      .fhImg {
        width: 0.55rem;
        height: 0.55rem;
        border-radius: 0.1rem;
      }
      .rt-column {
        width: 2.55rem;
        //   height: 2.55rem;
        margin-left: 0.2rem;
        .rt-title {
          font-size: 0.16rem;
          font-family: PingFang SC;
          font-weight: 500;
          color: #191f25;
          margin-bottom: 0.16rem;
        }
        .rt-row {
          display: flex;
          justify-content: space-between;
          margin-bottom: 0.23rem;
          .column {
            //    border: 1px solid red;
            width: 1.5rem;
            .column-t {
              font-size: 0.14rem;
              font-family: PingFang SC;
              font-weight: 400;
              color: #888888;
              display: block;
              width: 100%;
              margin-bottom: 0.03rem;
            }
            .column-c {
              font-size: 0.16rem;
              font-family: PingFang SC;
              font-weight: 400;
              color: #191f25;
              display: block;
              width: 100%;
            }
          }
        }
      }
    }
  }
}
.search-bottom {
  width: 100%;
  height: 100px;
  background: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: fixed;
  bottom: 0px;
  padding: 0 11px;
  box-sizing: border-box;
  font-size: 32px;
  font-weight: 500;
  z-index: 9;
  .searchContain {
    .btn {
      display: inline-block;
      box-sizing: border-box;
      width: 124px;
      height: 64px;
      align-items: center;
      border-radius: 6px;
      margin-right: 18px;
      text-align: center;
      line-height: 64px;
    }
    .confirm {
      background: #1890ff;
      color: #ffffff;
    }
    .cancel {
      border: 1px solid #b2b2b2;
      background: #f6f6f6;
      color: #5a5a5a;
    }
  }
}
</style>
